/**
 * Du an danh co shogi online duoc phat trien boi Le Thanh Nghi
 * thuoc cong ty N&N.,Inc
 */
package at.com.vn.chess.element;

import java.awt.Color;
import java.awt.Font;
import java.awt.Label;
import java.awt.Rectangle;



import vn.nnn.shogi.board.Board;

/**
 * @author nghilt 2011/10/14
 */
public class PlayerInfoArea {
	
	private Label lblPlayer1Name;	
	private Label lblPlayer2Name;
	
	private StopWatch globalPlayer1StopWatch;
	private StopWatch globalPlayer2StopWatch;

	public PlayerInfoArea( Board board ) {
		lblPlayer1Name = createNameLabel( board.getVungThongTinQuanTrang()[0] );
		globalPlayer1StopWatch = new StopWatch( board.getVungThongTinQuanTrang()[1] );
		
		lblPlayer2Name = createNameLabel( board.getVungThongTinQuanDen()[0] );
		globalPlayer2StopWatch = new StopWatch( board.getVungThongTinQuanDen()[1] );
	}
	
	private Label createNameLabel( Rectangle rect ) {
		
		Font ver = new Font("Verdana", 0, 24);
		Label lblName = new Label();
		lblName.setBounds( rect.x, rect.y, rect.width, rect.height );
		lblName.setFont(ver);
		lblName.setForeground(new Color(192, 192, 181));
		lblName.setBackground(new Color(74, 13, 4));
		lblName.setText( "(none)" );
		
		return lblName;
	}
	
	public Label getLblPlayer2Name() {
		return lblPlayer2Name;
	}
	
	public Label getLblPlayer1Name() {
		return lblPlayer1Name;
	}

	public StopWatch getGlobalPlayer1StopWatch() {
		return globalPlayer1StopWatch;
	}

	public StopWatch getGlobalPlayer2StopWatch() {
		return globalPlayer2StopWatch;
	}
	
	public void setPlayer1Name( String name ) {
		if( !name.isEmpty() ) {
			lblPlayer1Name.setText( name );	
		}else {		
			lblPlayer1Name.setText( "(none)" );
		}
	}
	
	public void setPlayer2Name( String name ) {
		if( !name.isEmpty() ) {
			lblPlayer2Name.setText( name );	
		}else {		
			lblPlayer2Name.setText( "(none)" );
		}
	}
}
